package demo.hw;

import java.util.HashSet;
import java.util.Set;

/**
 * 统计字符串再(0~127)范围内的个数
 *
 * @author taqo
 * @date 2021/5/25
 */
public class _字符个数统计 {
    public static void main(String[] args) {
        String a = "abcadeff-1";
        count(a);
    }

    private static void count(String a) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < a.length(); i++) {
            int cc = a.charAt(i);
            if (cc > 0 && cc < 127) {
                set.add(cc);
            }
        }
        System.out.println(set.size());
    }
}
